package com.ruoyi.deeplearn.service.impl;

import java.util.List;

import cn.hutool.core.util.IdUtil;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.deeplearn.mapper.DeepTagGroupMapper;
import com.ruoyi.deeplearn.domain.DeepTagGroup;
import com.ruoyi.deeplearn.service.IDeepTagGroupService;

/**
 * 标签组Service业务层处理
 *
 * @author rww
 * @date 2022-12-10
 */
@Service
public class DeepTagGroupServiceImpl implements IDeepTagGroupService
{
    @Autowired
    private DeepTagGroupMapper deepTagGroupMapper;

    /**
     * 查询标签组
     *
     * @param groupId 标签组主键
     * @return 标签组
     */
    @Override
    public DeepTagGroup selectDeepTagGroupByGroupId(Long groupId)
    {
        return deepTagGroupMapper.selectDeepTagGroupByGroupId(groupId);
    }

    /**
     * 查询标签组列表
     *
     * @param deepTagGroup 标签组
     * @return 标签组
     */
    @Override
    public List<DeepTagGroup> selectDeepTagGroupList(DeepTagGroup deepTagGroup)
    {
        return deepTagGroupMapper.selectDeepTagGroupList(deepTagGroup);
    }

    /**
     * 新增标签组
     *
     * @param deepTagGroup 标签组
     * @return 结果
     */
    @Override
    public int insertDeepTagGroup(DeepTagGroup deepTagGroup)
    {
        deepTagGroup.setGroupId(IdUtil.getSnowflakeNextId());
        deepTagGroup.setCreateTime(DateUtils.getNowDate());
        return deepTagGroupMapper.insertDeepTagGroup(deepTagGroup);
    }

    /**
     * 修改标签组
     *
     * @param deepTagGroup 标签组
     * @return 结果
     */
    @Override
    public int updateDeepTagGroup(DeepTagGroup deepTagGroup)
    {
        deepTagGroup.setUpdateTime(DateUtils.getNowDate());
        return deepTagGroupMapper.updateDeepTagGroup(deepTagGroup);
    }

    /**
     * 批量删除标签组
     *
     * @param groupIds 需要删除的标签组主键
     * @return 结果
     */
    @Override
    public int deleteDeepTagGroupByGroupIds(Long[] groupIds)
    {
        return deepTagGroupMapper.deleteDeepTagGroupByGroupIds(groupIds);
    }

    /**
     * 删除标签组信息
     *
     * @param groupId 标签组主键
     * @return 结果
     */
    @Override
    public int deleteDeepTagGroupByGroupId(Long groupId)
    {
        return deepTagGroupMapper.deleteDeepTagGroupByGroupId(groupId);
    }
}
